< previous page page_655 next page >

Page 655
Example program Persp uses this projection matrix to display perspective views of a hypercube. The program first rotates the hypercube around the six coordinate planes using angles that you specify. It then applies a perspective projection to transform the hypercube into a three-dimensional object. Next it rotates the resulting object around the X, Y, and Z axes in three dimensions, again using angles you specify. This allows you to view the three-dimensional projection of the hypercube from different directions. Finally, the program performs a parallel projection into two dimensions by simply ignoring the points' Z coordinates.
Figure 18.5 shows a parallel projection of a perspective projection of a hypercube. The preprojection angles are all zero, so the hypercube was not rotated before the perspective projection down to three dimensions. The center of projection is located at (0, 0, 0, 3). After the hypercube was projected into three-dimensional space, it was rotated by 0.2 radians around the X axis and 0.1 radians around the Y axis.
You can still view the hypercube as two related three-dimensional cubes connected at the corners. In Figure 18.5, the inner and outer cubes are made up of the hypercube's corners where W = 1 and W = 1, respectively.
The inner cube is smaller because in four dimensions, it is farther from the center of projection at (0, 0, 0, 3). The points that make up the inner cube have W coordinates 1 while those in the outer cube have W coordinates +1.
If you rotate the hypercube before you project it from four dimensions into three, you can get strange results like those shown in Figure 18.6. In this picture, the hypercube was rotated through an angle of 0.8 radians around the X-Z plane before the perspective projection. If you look closely, you can still find pairs of three-dimensional cubes.
0655-01.jpg
Figure 18.5
A parallel projection of a perspective projection of a hypercube.

 
< previous page page_655 next page >